<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/事件冒泡.css">
</head>
<body>
    <div class="box boxA">
        <div class="box boxB">
            <div class="box boxC"></div>
        </div>
    </div>
    <script>
        var boxs = document.getElementsByClassName("box");
        [].forEach.call(boxs, function(item){
            item.addEventListener('click', function(){
                console.log(this.classList[1]);
                
            }, false)
        })
        // var boxA = document.querySelector(".boxA");
        // var boxB = document.querySelector(".boxB");
        // var boxC = document.querySelector(".boxC");
        // boxA.addEventListener('click', function(){
        //     console.log("a");
        //     console.log(this);
            
        // }, false);
        // boxB.addEventListener("click",function(){
        //     console.log("b");
        // },false);
        // boxC.addEventListener('click', function(e){
        //     e.stopPropagation();
        //     console.log("c");
        // }, false);
    </script>
</body>
</html>